<?php	
/*\
 *
 *
 *
 *
\*/	oh_module_header();

#module main function
function oh_function_databaseform($m) {
	return oh_this();
}

#module main class
class oh_class_databaseform {		
	function oh_class_databaseform() {
		
	}
	function draw($table) {
		$t = oh("mysql")->get_results("DESC $table");

		$f = oh("simpleform")->open("");			
		foreach($t as $l) {
			
			$l->Type = explode("(",$l->Type);
			$l->TypeName = $l->Type[0];
			$l->TypeSize = isset($l->Type[1]) ? intval($l->Type[1]) : 0;
			switch($l->TypeName) {
				case "int":$f->label(ucfirst($l->Field))->text($t."_".$l->Field)->br();
			}
		}
		$f->close();
	}
}
